package com.xormedia.httpservice.util;

import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

/**
 * com.xormedia.httpservice.MimeUnit
 * 
 * @author zhikang.peng
 * @date 2017年6月20日上午10:41:02
 * @since 1.0
 */
public class MimeUnit {
  private Properties properties;
  public static MimeUnit mime;

  public MimeUnit() {
    try {
      init();
    } catch (FileNotFoundException e) {
      e.printStackTrace();
    } catch (IOException e) {
      e.printStackTrace();
    }
  }

  private void init() throws FileNotFoundException, IOException {
    InputStream input = this.getClass().getResourceAsStream("mime.properties");
    properties = new Properties();
    properties.load(input);
    input.close();
    mime = this;
  }

  public String getMime(String key) {
    return properties.getProperty(key, "");
  }

}
